package com.superfeng.cloud.controller;

import com.superfeng.cloud.entity.Dept;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

@RestController
public class RibbonController {
    @Resource
    private RestTemplate restTemplate;
    // 服务器在eureka 注册的实例名称
    private static final String url = "http://API8081";

    @GetMapping("/getDeptNo/{deptNo}")
    public Dept getDept(@PathVariable String deptNo){
        return restTemplate.getForObject(url + "/serverApi8081/dept/getDeptId/"+deptNo,Dept.class);
    }

}
